package com.example.ktapplication.utils

import android.content.Context
import android.view.Gravity
import android.view.LayoutInflater
import android.widget.TextView
import android.widget.Toast
import com.example.ktapplication.R

object ToastUtil {

    fun showToast(context: Context, text: String) {
        val toast = Toast(context)
        val view = LayoutInflater.from(context).inflate(R.layout.custom_toast, null)
        view.findViewById<TextView>(R.id.tv_text).text = text
        toast.view = view
        toast.setGravity(Gravity.CENTER_HORIZONTAL, 0, DpUtils.getInstance().px2dp(context, 180f))
        toast.show()
    }

}